/*
int
parse 5 5
parse 2+3 5
parse '2*3' 6
parse '2+3+4' 9
parse '2*3+4' 10
parse '2+3*4' 14
parse '2*3*4' 24
noparse x Additive 1
*/

# Bryan Ford's trivial grammar with ref_ptr():

Additive <- m:Multitive "+" a:Additive { m + a } / m:Multitive -> m
Multitive <- p:Primary "*" m:Multitive { p * m } / p:Primary -> p
Primary <- "(" a:Additive ")" -> a / d:Decimal -> d
Decimal <- Digit { *ref_ptr(ref()) - '0' }
Digit :: void <- "0" / "1" / "2" / "3" / "4" / "5" / "6" / "7" / "8" / "9"
